<%--

  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the latest version of the GNU Lesser General
  Public License as published by the Free Software Foundation;

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with this program (LICENSE.txt); if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

--%>
<%@ page errorPage="/WEB-INF/jsp/error.jsp"
    contentType="text/html; charset=utf-8"
%>
<%@page import="org.jamwiki.servlets.LinkUtilEx"%>
<%@page import="org.lightframework.jamwiki.servlets.WikiContext"%>

<%@ include file="page-init.jsp" %>

<style type="text/css">
#wiki-page{
	background-color:#FFFFFF;
	padding:0;
}
#wiki-content{
	margin:0;
	padding:0;
}
#contents{
	border:0;
	padding:8px;
}
</style>

<c:if test="${!empty editResolve}">
<div class="message red"><fmt:message key="edit.exception.conflict" /></div>
</c:if>

<c:if test="${!empty topicVersionId}"><div class="message red"><fmt:message key="edit.warning.oldversion" /></div></c:if>

<c:if test="${!empty hasSpam}">
<div class="message red"><fmt:message key="${spam.key}"><fmt:param value="${spam.params[0]}" /></fmt:message></div>
</c:if>
<jamwiki:enabled property="PROP_TOPIC_USE_PREVIEW">
<c:if test="${!empty editPreview}">
<div class="message red"><fmt:message key="edit.warning.preview" /></div>
<hr/>
<%@ include file="view-topic-include.jsp" %>
<hr/>
</c:if>
</jamwiki:enabled>

<fieldset>
<legend><fmt:message key="topic.caption.editlegend" /></legend>

<form method="post" name="editForm" id="editForm" action="<jamwiki:link value="Special:Edit" />">
<input type="hidden" name="topic" value="<c:out value="${pageInfo.topicName}" />" />
<input type="hidden" name="lastTopicVersionId" value="<c:out value="${lastTopicVersionId}" />" />
<input type="hidden" name="section" value="<c:out value="${section}" />" />
<input type="hidden" name="topicVersionId" value="<c:out value="${topicVersionId}" />" />
<input type="hidden" name="return_to" value="<%=WikiContext.returnto()%>"/>

<table border="0" width="99%">
<tbody>
<tr>
	<td nowrap>
		<c:choose>
			<c:when test="${editor == 'toolbar'}">
				<%@ include file="editor-toolbar-include.jsp" %>
			</c:when>
		</c:choose>	
	</td>
	<td align="left" valign="bottom" width="100%">
		&nbsp;<a href="<%=LinkUtilEx.buildSpecialTopicUrl("Help:Formatting")%>" target="_blank" style="font-size:80%" title="<fmt:message key="common.help" />"><img border="0" src="<%=context%>/images/help.jpg"/></a>
	</td>
	<td align="right" nowrap>
		<input type="submit" name="save" value="<fmt:message key="common.save" />"  accesskey="s" />
		<jamwiki:enabled property="PROP_TOPIC_USE_PREVIEW"><input type="submit" name="preview" value="<fmt:message key="edit.action.preview" />" accesskey="p" /></jamwiki:enabled>
		<input type="button" name="cancel" value="<fmt:message key="common.cancel" />" onclick="document.location='./${pageInfo.pageTitle.params[0]}'"/>
	</td>
</tr>
</tbody>
</table>

<p>
<textarea id="topicContents" name="contents" rows="25" cols="80" accesskey=","><c:out value="${contents}" escapeXml="true" /></textarea>
</p>


<table border="0" width="99%">
<tbody>
<tr>
	<td align="right" nowrap>
		<input type="submit" name="save" value="<fmt:message key="common.save" />"  accesskey="s" />
		<jamwiki:enabled property="PROP_TOPIC_USE_PREVIEW"><input type="submit" name="preview" value="<fmt:message key="edit.action.preview" />" accesskey="p" /></jamwiki:enabled>
		<input type="button" name="cancel" value="<fmt:message key="common.cancel" />" onclick="document.location='./${pageInfo.pageTitle.params[0]}'"/>
	</td>
</tr>
</tbody>
</table>
</form>

</fieldset>
